<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"      
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:ezcomp="http://java.sun.com/jsf/composite/ezcomp">

    <ui:composition template="default_layout_with_menu.xhtml">
        <ui:define name="titulo-pagina">Fornecedores</ui:define>
        <ui:define name="content">
            <p:messages />

            <p:commandButton ajax="false" value="Novo" action="#{fornecedorJsfBean.criarObj}" image="novo"/>
            <p:commandButton ajax="true" value="Atualizar listagem" action="#{fornecedorJsfBean.atualizar}" update="tabela1" image="atualizar"/>

            <p:dataTable id="tabela1" value="#{fornecedorJsfBean.fornecedores}" var="item"
                         emptyMessage="Nenhum registro cadastrado." >
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Id"/>
                    </f:facet>
                    <h:outputText value="#{item.id}"/>
                </p:column>

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Nome"/>
                    </f:facet>
                    <h:outputText value="#{item.nome}"/>
                </p:column>

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Ações"/>
                    </f:facet>

                    <ezcomp:imgActionDatatable bean="#{fornecedorJsfBean}" tipo="edit"/>
                    <ezcomp:imgActionDatatable bean="#{fornecedorJsfBean}" tipo="del"/>
                </p:column>
            </p:dataTable>

        </ui:define>
    </ui:composition>

</html>

